import { createStore, applyMiddleware } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension' // 开发者工具
import thunk from 'redux-thunk' // 异步解决中间件
import { getToken } from '../utils/token' // token 功能模块
import rootReducer from './reducers' // 引用reducer

const middleWare = composeWithDevTools(applyMiddleware(thunk))

// createStore 三个参数全传
const initialState = {
  Login: getToken(),
}
const store = createStore(rootReducer, initialState, middleWare)

export default store
